package com.example.demo.aliyunmessage.service;

import com.aliyuncs.exceptions.ClientException;
import com.example.demo.aliyunmessage.entity.Message;
import com.example.demo.utils.SendMessageUtil;
import com.google.gson.JsonObject;
import org.springframework.stereotype.Service;

/**
 * @ClassName MessageServiceImpl
 * @Author lys4134
 * @Date 2021/08/03 17:43:43
 * @Description MessageServiceImpl
 * @Version 1.0
 **/
@Service
public class MessageServiceImpl {
    public void sendSms() throws ClientException {
        Message message = new Message();
        message.setMobile("18779229821");
        JsonObject templateParam = new JsonObject();
        templateParam.addProperty("phone", "18779229821");
        templateParam.addProperty("name", "刘桂华");
        String params = templateParam.toString();
        message.setTemplateParam(params);
        SendMessageUtil.sendSms(message);
    }
}
